<template>
    
    <!-- 组件的模板 -->
    <div class="weui-cells" v-if='this.type == 1'>
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" placeholder="请输入" v-model="real_name"/>
            </div>
        </div>
    </div>
    <div class="weui-cells weui-cells_radio" v-if='this.type == 2'>
        <label class="weui-cell weui-check__label" for="x11">
            <div class="weui-cell__bd">
                <p>男</p>
            </div>
            <div class="weui-cell__ft">
                <input type="radio" class="weui-check" name="radio1" id="x11" :checked="gender === '男'" v-model="gender" value="男">
                <span class="weui-icon-checked"></span>
            </div>
        </label>
        <label class="weui-cell weui-check__label" for="x12">
            <div class="weui-cell__bd">
                <p>女</p>
            </div>
            <div class="weui-cell__ft">
                <input type="radio" name="radio1" class="weui-check" id="x12" :checked="gender === '女'" v-model="gender" value="女">
                <span class="weui-icon-checked"></span>
            </div>
        </label>
    </div>
</template>

<script>
    /**
     *  引入工具类库 或 Native API
     *  example : import widget from 'gapi/widget'
     */
    // import clientUi from 'gapi/clientUi.js'
    // import widget from 'gapi/widget.js'
    import commonPage from 'clientApi/commonPage.js'
    // import userCenterApi from 'clientApi/userCenterApi.js'
    // import cache from 'gapi/cache.js'
    import * as util from 'js/util.js'
    // import Empty from 'components/Empty/Empty'
    // import KCApiApp from 'clientApi/KCApiApp.js'
    /**
     *  引入组件 以及 组件接口(Action)
     *  example : import Somecomponents from 'components/Somecomponents/Somecomponents'
     */

    /**
     *  组件实例对象
     */
    export default {
        components: {

        },
        data: function(){
            return{
                real_name: '',
                gender: '',
            }
        },
        vuex: {
            getters: {

            },
            actions: {

            }
        },
        methods: {
            /**
             * 初始化
             * @method init
             * @public
             * @return {Null} void
             */
            init (){
                this.type = util.getUrddataString('type')
                if(this.type == 1){
                    document.title = '设置姓名'
                    this.real_name = util.getUrddataString('real_name')
                }else if(this.type == 2){
                    document.title = '设置性别'
                    this.gender = util.getUrddataString('gender')
                }
                
            },
            saveResume(){
                // alert(this.real_name)
                
                if(this.type == 1){
                    commonPage.goBack(1,{'key':'real_name','value':this.real_name})
                }else if(this.type == 2){
                    commonPage.goBack(1,{'key':'gender','value':this.gender})
                }
            }
        },
        created(){

            this.init();

            // 获取native标题
            commonPage.updateTitleBar({
                backAction: '',    // 点击返回按钮的动作（即回调函数名称）
                leftDisplay: false,            // 是否显示左按钮
                leftText: '',                // 左按钮文案
                leftAction: '',    // 点击左按钮的动作（即回调函数名称）
                rightDisplay: true,            // 是否显示右按钮
                rightText: '完成',            // 右按钮文案
                rightAction: 'saveResume'    // 点击右按钮的文案（即回调函数名称）
            })
            window.saveResume = this.saveResume
        }
        
    }

    
</script>

<!-- CSS 样式 -->
<!-- <style src="static/css/global.css"></style> -->
<style src="../../node_modules/weui/dist/style/weui.css"></style>
<style src="../../static/css/common.css"></style>
<style src="../../static/css/project.css"></style>



